package cn.itsource.feignclient;

import cn.itsource.fallback.RedisFallbackFactory;
import cn.itsource.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.cloud.openfeign.FeignClient;
//负载均衡器负载调用redis数据库,调用哪个服务
@FeignClient(value = "redis-server",fallbackFactory = RedisFallbackFactory.class)
public interface FeignClientt {
    @PostMapping("/redis/set")
//    @RequestParam:从请求中获取值
    AjaxResult set(@RequestParam("key") String key , @RequestParam("value") String value);
    @GetMapping("/redis/get/{key}")
//    @PathVariable:从请求中获取传递的参数
     AjaxResult get(@PathVariable("key") String key );
}
